<template>
  <div class="campus-open-form">
    <el-card class="form-card" shadow="never">
      <el-row :gutter="20">
        <el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="140px" label-position="right" :disabled="setting.readonly">
          <el-col :span="24" class="section-title">
            <el-form-item label-width="0">
              <groupTitle content-position="left" content="开业辅导计划"></groupTitle>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="校区品牌" prop="brand">
              <el-select v-model="dataForm.brand" placeholder="请选择签约品牌" @change="handleChangeBrand" filterable clearable required style="width: 100%">
                <el-option :key="item.id" :label="item.fullName" :value="item.enCode" v-for="item in brandOptions" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="judgeShow('campusId')">
            <el-form-item label="开业校区" prop="campusId">
              <el-select v-model="dataForm.campusId" placeholder="请选择" filterable clearable required style="width: 100%" :loading="campusLoading" @focus="loadCampusOptions">
                <el-option v-for="item in campusOptions" :key="item.id" :label="item.fullName" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="judgeShow('openDate')">
            <el-form-item label="开业日期" prop="openDate">
              <el-date-picker v-model="dataForm.openDate" placeholder="请选择" clearable required style="width: 100%" type="date" format="yyyy-MM-dd" value-format="timestamp"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="judgeShow('counselor')">
            <el-form-item label="开业辅导师" prop="counselor">
              <user-select v-model="dataForm.counselor" placeholder="请选择" clearable required style="width: 100%"></user-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="judgeShow('tutorialDate')">
            <el-form-item label="落地辅日期" prop="tutorialDate">
              <el-date-picker v-model="dataForm.tutorialDate" placeholder="请选择" clearable required style="width: 100%" type="dates" format="yyyy-MM-dd" value-format="yyyy-MM-dd"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="judgeShow('type')">
            <el-form-item label="开业类型" prop="type">
              <el-select v-model="dataForm.type" placeholder="请选择" filterable clearable required style="width: 100%">
                <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.fullName" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('plan')" class="upload-section">
            <el-form-item label="开业计划表" prop="plan">
              <div class="upload-tip">请上传校区的开业辅导计划表文件</div>
              <custom-upload-fz :type="'plan'" v-model="dataForm.plan" :fileSize="500" sizeUnit="MB" :limit="9" buttonText="点击上传文件"></custom-upload-fz>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('survey')" class="upload-section">
            <el-form-item label="校区市调表" prop="survey">
              <custom-upload-fz :type="'survey'" v-model="dataForm.survey" :fileSize="500" sizeUnit="MB" :limit="9" buttonText="点击上传文件"></custom-upload-fz>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('calendar')" class="upload-section">
            <el-form-item label="开业行事历" prop="calendar">
              <custom-upload-fz :type="'calendar'" v-model="dataForm.calendar" :fileSize="500" sizeUnit="MB" :limit="9" buttonText="点击上传文件"></custom-upload-fz>
            </el-form-item>
          </el-col>
          <el-col :span="24" class="section-title">
            <el-form-item label-width="0">
              <groupTitle content-position="left" content="校区开业招生情况"></groupTitle>
            </el-form-item>
          </el-col>
          <el-col :span="6" v-if="judgeShow('degreeCount')">
            <el-form-item label="校区学位" prop="degreeCount">
              <div class="number-input-wrapper">
                <el-input-number v-model="dataForm.degreeCount" :step="1" style="width: 150px"></el-input-number>
                <span class="unit-text">
                  个
                  <el-tooltip class="item" effect="dark" content="提示文字" placement="left-end">
                    <i class="el-icon-question" style="color:#409EFF"></i>
                  </el-tooltip>
                </span>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="6" v-if="judgeShow('bedNum')">
            <el-form-item label="校区床位" prop="bedNum">
              <div class="number-input-wrapper">
                <el-input-number v-model="dataForm.bedNum" :step="1" style="width: 150px"></el-input-number>
                <span class="unit-text">
                  个
                  <el-tooltip class="item" effect="dark" content="提示文字" placement="left-end">
                    <i class="el-icon-question" style="color:#409EFF"></i>
                  </el-tooltip>
                </span>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="6" v-if="judgeShow('regular')">
            <el-form-item label="正价招生" prop="regular">
              <div class="number-input-wrapper">
                <el-input-number v-model="dataForm.regular" :step="1" style="width: 150px"></el-input-number>
                <span class="unit-text">
                  人
                  <el-tooltip class="item" effect="dark" content="提示文字" placement="left-end">
                    <i class="el-icon-question" style="color:#409EFF"></i>
                  </el-tooltip>
                </span>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="6" v-if="judgeShow('lead')">
            <el-form-item label="引流招生" prop="lead">
              <div class="number-input-wrapper">
                <el-input-number v-model="dataForm.lead" :step="1" style="width: 150px"></el-input-number>
                <span class="unit-text">
                  人
                  <el-tooltip class="item" effect="dark" content="提示文字" placement="left-end">
                    <i class="el-icon-question" style="color:#409EFF"></i>
                  </el-tooltip>
                </span>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="judgeShow('price')" class="upload-section">
            <el-form-item label="校区价格表" prop="price">
              <custom-upload-fz :type="'price'" v-model="dataForm.price" :fileSize="500" sizeUnit="MB" :limit="9" buttonText="点击上传"></custom-upload-fz>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('environment')" class="upload-section">
            <el-form-item label="校区环境照片" prop="environment">
              <custom-upload-img :type="'environment'" v-model="dataForm.environment" :fileSize="500" sizeUnit="MB" :limit="9"></custom-upload-img>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('daySchedule')" class="upload-section">
            <el-form-item label="一日流程图片" prop="daySchedule">
              <custom-upload-img :type="'daySchedule'" v-model="dataForm.daySchedule" :fileSize="500" sizeUnit="MB" :limit="9"></custom-upload-img>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('team')" class="upload-section">
            <el-form-item label="团队风采图片" prop="team">
              <custom-upload-img :type="'team'" v-model="dataForm.team" :fileSize="500" sizeUnit="MB" :limit="9"></custom-upload-img>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('activity')" class="upload-section">
            <el-form-item label="开业活动图片" prop="activity">
              <custom-upload-img :type="'activity'" v-model="dataForm.activity" :fileSize="500" sizeUnit="MB" :limit="9"></custom-upload-img>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="judgeShow('summarize')" class="textarea-section">
            <el-form-item label="校区开业情况" prop="summarize">
              <el-input v-model="dataForm.summarize" placeholder="招生活动效果、团队合作与执行、后续跟进计划等。" show-word-limit style="width: 100%" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
    </el-card>
  </div>
</template>
<script>
export { default } from './index.js'
</script>
<style scoped>
.campus-open-form {
  padding: 20px;
}

.form-card {
  border-radius: 8px;
  border: 1px solid #e4e7ed;
}

.section-title {
  margin-top: 20px;
  margin-bottom: 10px;
}

.section-title:first-child {
  margin-top: 0;
}

.upload-section {
  margin-bottom: 15px;
}

.upload-tip {
  font-size: 12px;
  color: #606266;
  margin-bottom: 8px;
  line-height: 1.4;
}

.number-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unit-text {
  color: #606266;
  font-size: 14px;
  white-space: nowrap;
}

.textarea-section {
  margin-top: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .campus-open-form {
    padding: 10px;
  }

  .form-card :deep(.el-form-item__label) {
    width: 100px !important;
  }

  .form-card :deep(.el-form-item__content) {
    margin-left: 100px !important;
  }

  .number-input-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .unit-text {
    margin-left: 0;
  }
}

@media (max-width: 576px) {
  .form-card :deep(.el-col-12) {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .form-card :deep(.el-col-6) {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 10px;
  }

  .form-card :deep(.el-form-item__label) {
    width: 80px !important;
    font-size: 13px;
  }

  .form-card :deep(.el-form-item__content) {
    margin-left: 80px !important;
  }

  .number-input-wrapper .el-input-number {
    width: 120px !important;
  }
}

/* 表单项间距优化 */
.form-card :deep(.el-form-item) {
  margin-bottom: 18px;
}

.form-card :deep(.el-row) {
  margin-left: -10px;
  margin-right: -10px;
}

.form-card :deep(.el-col) {
  padding-left: 10px;
  padding-right: 10px;
}

/* 分组标题样式优化 */
.form-card :deep(.groupTitle) {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 5px;
  padding-bottom: 8px;
  border-bottom: 2px solid #409eff;
  display: inline-block;
}
</style>
